package com.frxuexi.apps.repository

import com.frxuexi.apps.ApiService
import com.frxuexi.apps.model.ApiResponse
import com.frxuexi.apps.model.RecordsData
import com.frxuexi.lib_commom.RetrofitManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

class NewsRepository {
    val apiService by lazy { RetrofitManager.getRetrofit().create(ApiService::class.java) }

    fun getNews(type:Int)=flow<ApiResponse<RecordsData>>{
        emit(apiService.getNews(type))
    }.flowOn(Dispatchers.IO)
}